<template>
    <el-dialog v-if="dialogVisible" :close-on-click-modal='false' title="店铺授权" top="5vh" :visible.sync="dialogVisible" @close="resetForm()" width="50%">
        <div class="font_14 color_01">授权示例图<span class="color_03"></span></div>
        <div class="font_14 color_02" style="margin-top:10px">请勾选“允许服务商管理敏感物料”，【不可多选】并且授权账号必须是【店铺角色】</div>
        <div class="shouquan_img">
            <img src="../../assets/img/qianchuan.jpg" alt="" style="width:100%">
        </div>
         <div class="font_14 color_01" style="margin:10px 0">授权链接</div>
        <el-link type="primary" :underline="false" @click="copy(url)">{{url}}</el-link>
        <span slot="footer" class="dialog-footer">
            <el-button size="small" type="primary" @click="resetForm()" class="el-button-width">关 闭</el-button>
        </span>
    </el-dialog>
</template>

<script>
export default {
    name: "",
    data() {
        return {
            url: "",
            dialogVisible: false,
        };
    },
    created() {},
    methods: {
        openViewImg(){
            this.$refs.view_img.getData()
        },
        //获取授权链接
        async getDataList() {
            const { data: res } = await this.$http.post(
                "qcadmin/Qcshop/grantAuthorization"
            );
            if (res.code !== 200) {
                this.$message.error(res.msg);
                return;
            } else {
                this.url = res.data.url;
            }
        },

        // 复制
        copy(text) {
            let url = text;
            let oInput = document.createElement("input");
            oInput.value = url;
            document.body.appendChild(oInput);
            oInput.select(); // 选择对象;
            document.execCommand("Copy"); // 执行浏览器复制命令
            this.$message({
                message: "复制成功",
                type: "success",
            });
            oInput.remove();
        },

        // 关闭重置表单
        resetForm() {
            this.dialogVisible = false;
        },
    },
    components: {
        
    },
};
</script>


<style scoped>
.shouquan_img {
    border: 1px solid #ebebeb;
    border-radius: 6px;
    padding: 20px;
    margin-top: 12px;
}
</style>
